<template>
  <el-dialog :title="title" :visible.sync="dialogFormVisible">
    <el-form :model="dept" label-width="200px">
      <el-form-item label="部门名称">
        <el-input v-model="dept.name" auto-complete="off"></el-input>
      </el-form-item>
      <el-form-item label="部门编码">
        <el-input v-model="dept.code" auto-complete="off"></el-input>
      </el-form-item>
      <el-form-item label="部门负责人">
        <el-input v-model="dept.manager" auto-complete="off"></el-input>
      </el-form-item>
      <el-form-item label="部门介绍">
        <el-input v-model="dept.introduce" auto-complete="off"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="saveDept">确 定</el-button>
      <el-button @click="dialogFormVisible = false">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { list, saveOrUpdate, detail } from "@/api/base/dept";
export default {
 
  data() {
    return {
      parentId: "",
      dept: {},
      title: "",
      dialogFormVisible: false,
    };
  },
  methods: {
    /**
     * 保存部门信息
     */
    saveDept() {
      saveOrUpdate(this.dept).then((res) => {
        this.$message({
          message: res.data.message,
          type: res.data.success ? "success" : "error",
        });
        if (res.data.success) {
          this.dialogFormVisible=false;
          this.$parent.getList();
        }
      });
    },
  },
};
</script>

<style>
</style>